package com.malljelly.study.social.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.social.security.SpringSocialConfigurer;

/**
 * Created by 骑着蜗牛去旅行 on 2018/8/24.
 */
@Configuration
public class ThirdloginSecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private SpringSocialConfigurer imoocSocialSecurityConfig;


    @Override
    protected  void  configure(HttpSecurity http) throws Exception {

            http.apply(imoocSocialSecurityConfig)
                .and()
                .authorizeRequests()  //对请求授权
                .antMatchers("/imooc-signIn.html").permitAll() //访问登录页不需要身份认证
                .anyRequest() //任何请求
                .authenticated() //身份认证
                .and()
                .csrf().disable(); //csrf关闭

    }
}
